# -*-  coding:utf-8 -*- 
# Author : lihongliang

uname = "aliang"
pwd = "abc123"
user_status = False

def login(auth_type):
    #print("autn_type:",auth_type)
    def outter(func):
        #print("login",func,auth_type)
        def inner(*args,**kwargs):
            global user_status

            if user_status == False:
                username = input("请输入用户名：")
                password = input("请输入密码：")
                if username == uname and pwd == password :
                    print(auth_type,"用户使用认证方式：%s 登录成功"% (auth_type))
                    func(*args,**kwargs)
                    user_status = True
                else:
                    print("用户或者密码错误！")
            elif user_status == True:
                print("用户使用认证方式：%s 已经登录，请直接进入"% (auth_type))
                func(*args, **kwargs)
        return inner
    return outter


def home():
    print("首页".center(59,"*"))

@login("weixin")        #认证方式
def bbs(chat):
    print("论坛%s".center(50,"*")% chat)

@login("qq")          #认证方式
def touzi(zijin):
    print("投入 %s ".center(50,"*")%zijin )


home()
bbs("BBS")
touzi("100")